package code.reptile.main;

import java.util.List;
import java.util.Map;

import code.excel.poi.WriteToFile;
import code.reptile.core.AnalzeHtml;

/**
* <p></p>
*
* @version 1.0
* @author:huangwf
* @date:2017/8/18 11:42
* @history
*/

public class GanJiReptile {

private final static String TEXTPRTHNAME = "reptile/out/text/AllCity.txt";

public static void main(String[] args) {
String url = "http://www.ganji.com/index.htm";
String filepath = "reptile/out/html/";
String path = null;
//        path = DownLoadFile.downloadFile(url,filepath);
path = "reptile/out/html/";
List<Map<String, Object>> list = AnalzeHtml.analzeHtmlByClass(path, "all-city", "a", "href");
for (Map<String, Object> item : list) {
String result = item.get(AnalzeHtml.HTML_TEXT) + ":" + item.get(AnalzeHtml.HTML_ATTR);
System.out.println(result);
WriteToFile.witeToText(result+"\n",TEXTPRTHNAME);
}
WriteToFile.witeToText("#############################################",TEXTPRTHNAME);
}
}
